There are three ways to create a SimpleXML object:
Create using the New keyword
The code is as follows
Copy Code
$xml = "$rss =new simplexmlelement ($xml);
Using Simplexml_load_string () to create
The code is as follows
Copy Code
$xml = "$rss =simplexml_load_string ($
To generate a File object: FileName File = new file (GetClass (). getClassLoader (). GetResource ("Test.xml"). GetPath ());// Directly get an input stream: InputStream in = GetClass (). getClassLoader (). getResourceAsStream ("Test.xml");//fetch at current thread-this method is not stable// String path = Thread.CurrentThread (). Getcontextclassloader (). GetResou
("")System.getproperty ("User.dir") "called at different locations, gets the path is dynamically changing"2. Get Local PathJSP, Request.getparameter ("MyFile");Actionform.getmyfile ();Get the same value: such as D:\VSS installation directory \users.txt*********************************This.getclass (). getClassLoader (). GetResource (""). GetPath ();==/d:/workspace/strutstest/webroot/web-inf/classes/This.getclass (). GetResource (""). GetPath (). toString ();==/d:/workspace/strutstest/webroot/we
sun JAXM is also used dom4j. Many of the current open source projects use dom4j, for example, the famous hibernate also uses dom4j to read XML configuration files. Consider the possibleThe portability of dom4j is not good.4.JDOM mode: The jdom itself does not contain parsers. It usually uses the SAX2 parser to parse and certify the input
The previous properties article has described the basic usage of the Java configuration file class properties, and when viewing the Help documentation for the JDK, there are also two methods in the Properties class LoadFromXML (InputStream) and S Toretoxml (OutputStream, String, String), the XML in the method name is not difficult to determine that the two method
Read the local XML file, parsing through the DOM, Dom parsing is characterized by loading the entire XML file into memory, forming a DOM tree structure, the tree structure is convenient traversal and manipulation.
The characteristic of Dom parsing is to
Touch Java soon, I have a harvest, and recently want to do a web version of the RSS reader to exercise. There are several OPML files that are exported from different versions of Foxmail, and you should know that OPML files are in XML format. So let's start here and practice reading XML files using DOM4J.
In Java progr
A few days ago, with Dom4j wrote three versions of the read XML file, now share the next.First version:XML:dom4j reads this XML code as follows:public static void Read () {try {//Read and parse
1, performance: a ". xml" file with an extension2. Storage: Tree-shaped structure3. XML parsing application:Communication between different applications-booking software and payment softwareCommunication between different platforms--operating systemSharing data between different platforms--websites and mobile phones4.The process of reading an
The XML file is designed to transmit and store data with the focus on the data content.
HTML is designed to display data with focus on the appearance of the data.
XML is just a text file that can be edited by any text editor in general.
XML does not have a predef
Original: Java read XML file generic tool class (recursive call) source code download address: http://www.zuidaima.com/share/1550463285480448.htm
The Java implementation reads the XML file
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.